﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="lhgdialog/lhgdialog.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        
        var time = 0;
        var flash = null;
        
        function ShowTime(){
            var showTimeStr;
            
            if(time > 0){
                var min = Math.floor( time / 60 );
                var sec = time % 60;
                
                if (min < 10) {
						min = "0" + min;
					}
				if (sec < 10) {
					sec = "0" + sec;
				}
				
				showTimeStr = min + ":" + sec;
						
                $("#time").html(showTimeStr);
                
                time--;
            }else{
                flash.show();
                time = 600;
            }
        }
        
        $(function(){
            $.post("api.aspx", function(json){
                time = json.end;
                
                setInterval(ShowTime, 1000);
                
            }, "json");
            
            flash = $.dialog({title:'', height:540, width:750, padding: 0, content: 'url:http://www.kkcai.net:9000/sc.htm'});
            flash.hide();
        });
    </script>
    <style type="text/css">
        a{ visibility:hidden; }
    </style>
</head>
<body>
    <span id="time"></span>
</body>
</html>
